﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Objects.DataClasses;

namespace FRL.DebtChased.Repository
{

	/// <summary>
	/// Extensions to the DevMessageExt model
	/// </summary>
	public partial class DevMessage
	{

		/////////////////////////////////////////////////////////////
		// Enumerations

		public enum ePriority
		{
			Immediate = 3,
			Medium = 2,
			Low = 1
		}

		public enum eCategory
		{
			Bug = 1,
			RequestForCahnge = 2,
		}

		/////////////////////////////////////////////////////////////
		// Attributes

		public ePriority Priority
		{
			get { return (ePriority)this.fdPriority; }
			set { this.fdPriority = (int)value; }
		}

		public eCategory Category
		{
			get { return (eCategory)this.fdCategory; }
			set { this.fdCategory = (int)value; }
		}

		/////////////////////////////////////////////////////////////
		// Static Operations

		public static void Save(DebtChasedEntities ent, int iUserId, string strPage, string strDescription, ePriority Priority, eCategory Category)
		{

			// Create a new object
			DevMessage dm = ent.DevMessages.CreateObject();
			dm.UserId = iUserId;
			dm.Page = strPage;
			dm.Priority = Priority;
			dm.Category = Category;
			dm.Date = DateTime.Now;
			dm.Description = strDescription;

			// Save to entities
			ent.DevMessages.AddObject(dm);
			ent.SaveChanges();

		}

	}

}
